package bmptest.bmp.exception;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @Description 全局异常处理类
 * @author lyq
 * @since 2021年5月10日
 * @version
 */
@ControllerAdvice
public class GlobalException {

    private static final Logger logger = LogManager.getLogger(GlobalException.class);


    /**
     * 描述：捕获 ArithmeticException 异常
     * @param e 将产生异常对象注入到方法中
     */
    @ExceptionHandler(value = {ArithmeticException.class})
    public void arithmeticExceptionHandle( Exception e) {
        logger.warn(e.getMessage());
    }

}
